<?php
	class PaymethodsController extends AppController{
		var $name ='Paymethods';
		var $helpers = array('Html','Ajax','Javascript','Form','Session');
		//var $uses = array('Order','Customer','Paymethod');
		
		function index($id=null){
			$this->layout = "home";	
			$this->Paymethod->id = $id;
			$this->set('paymethodread',$this->Paymethod->read());
			$this->set('allpaymethod',$this->Paymethod->find('all'));
		}
		function save($id = null){
		$id = $_REQUEST['id'];
		$name =$_REQUEST['name'];
		$pay_gate = $_REQUEST['pay_gate'];
		$website= $_REQUEST['website'];
		$description =$_REQUEST['description'];
		if(($id != null) && ($id != "")){
			$this->Paymethod->id = $id;
			$this->Paymethod->set('name',$name);
			$this->Paymethod->set('pay_gate',$pay_gate);
			$this->Paymethod->set('website',$website);
			$this->Paymethod->set('description',$description);
			$this->Paymethod->save();
		}
		else
		{
			$this->Paymethod->create();
			$this->Paymethod->set('name',$name);
			$this->Paymethod->set('pay_gate',$pay_gate);
			$this->Paymethod->set('website',$website);
			$this->Paymethod->set('description',$description);
			$this->Paymethod->saveAll();
		}
		$this->redirect(array("action" => "index"));
		}
		function delete() {
		$id= $_REQUEST['id'];
		if($id !=null && $id !=""){
		$this->Paymethod->delete($id);
		$this->Session->setFlash(__('ban co chac xoa san pham khong', true));
		$this->redirect(array("action" => "index"));
		}
		}
	}
?>